// import 'package:ichinesereader/models/book/Series.dart';
// import 'package:ichinesereader/models/book/BookFeatures.dart';
// import 'package:ichinesereader/models/book/InterestLevel.dart';
// import 'package:ichinesereader/models/book/BookLevel.dart';
// import 'package:ichinesereader/models/book/ProgramTypes.dart';
// import 'package:ichinesereader/models/book/TextType.dart';
// import 'package:ichinesereader/models/book/TextTypeResp.dart';

// class BookDetails {
//   BookDetails({
//     this.assessment,
//     this.assessmentLevel,
//     this.audio,
//     this.bilingual,
//     this.bookCode,
//     this.bookContentLink,
//     this.bookFeatures,
//     this.bookId,
//     this.bookImageLink,
//     this.bookTitle,
//     this.createTime,
//     this.description,
//     this.enabled,
//     this.endDate,
//     this.englishBookTitle,
//     this.interestLevels,
//     this.keyword,
//     this.keywords,
//     this.language,
//     this.level,
//     this.newArival,
//     this.proficiencyLevel,
//     this.programTypes,
//     this.quiz,
//     this.quizLinkUrl,
//     this.series,
//     this.startDate,
//     this.teacherAssessment,
//     this.teacherResource,
//     this.textType,
//     this.textTypeResps,
//     this.topBook,
//     this.topics,
//     this.traditionalTitle,
//     this.uploadDate,
//     this.viewMode,
//   });

//   bool? assessment;
//   String? assessmentLevel;
//   String? audio;
//   bool? bilingual;
//   String? bookCode;
//   String? bookContentLink;
//   BookFeatures? bookFeatures;
//   String? bookId;
//   String? bookImageLink;
//   String? bookTitle;
//   int? createTime;
//   String? description;
//   bool? enabled;
//   int? endDate;
//   String? englishBookTitle;
//   List<InterestLevel>? interestLevels;
//   List<String>? keyword;
//   String? keywords;
//   String? language;
//   Level? level;
//   bool? newArival;
//   int? proficiencyLevel;
//   List<ProgramType>? programTypes;
//   bool? quiz;
//   String? quizLinkUrl;
//   List<Series>? series;
//   int? startDate;
//   bool? teacherAssessment;
//   bool? teacherResource;
//   List<TextType>? textType;
//   List<TextTypeResp>? textTypeResps;
//   bool? topBook;
//   List<String>? topics;
//   String? traditionalTitle;
//   //DateTime? uploadDate;
//   int? uploadDate;
//   String? viewMode;

//   factory BookDetails.fromJson(Map<String, dynamic> json) => BookDetails(
//         assessment: json["assessment"],
//         assessmentLevel: json["assessmentLevel"],
//         audio: json["audio"],
//         bilingual: json["bilingual"],
//         bookCode: json["bookCode"],
//         bookContentLink: json["bookContentLink"],
//         bookFeatures: json["bookFeatures"] != null
//             ? BookFeatures.fromJson(json["bookFeatures"])
//             : null,
//         bookId: json["bookId"],
//         bookImageLink: json["bookImageLink"],
//         bookTitle: json["bookTitle"],
//         createTime: json["createTime"],
//         description: json["description"],
//         enabled: json["enabled"],
//         endDate: json["endDate"],
//         englishBookTitle: json["englishBookTitle"],
//         interestLevels: json["interestLevels"] != null
//             ? List<InterestLevel>.from(
//                 json["interestLevels"].map((x) => InterestLevel.fromJson(x)))
//             : null,
//         keyword: json["keyword"] != null
//             ? List<String>.from(json["keyword"].map((x) => x))
//             : null,
//         keywords: json["keywords"],
//         language: json["language"],
//         level: json["level"] != null ? Level.fromJson(json["level"]) : null,
//         newArival: json["newArival"],
//         proficiencyLevel: json["proficiencyLevel"],
//         programTypes: json["programTypes"] != null
//             ? List<ProgramType>.from(
//                 json["programTypes"].map((x) => ProgramType.fromJson(x)))
//             : null,
//         quiz: json["quiz"],
//         quizLinkUrl: json["quizLinkUrl"],
//         series: json["series"] != null
//             ? List<Series>.from(json["series"].map((x) => Series.fromJson(x)))
//             : null,
//         startDate: json["startDate"],
//         teacherAssessment: json["teacherAssessment"],
//         teacherResource: json["teacherResource"],
//         textType: json["textType"] != null
//             ? List<TextType>.from(
//                 json["textType"].map((x) => TextType.fromJson(x)))
//             : null,
//         textTypeResps: json["textTypeResps"] != null
//             ? List<TextTypeResp>.from(
//                 json["textTypeResps"].map((x) => TextTypeResp.fromJson(x)))
//             : null,
//         topBook: json["topBook"],
//         topics: json["topics"] != null
//             ? List<String>.from(json["topics"].map((x) => x))
//             : null,
//         traditionalTitle: json["traditionalTitle"],
//         //uploadDate: DateTime.parse(json["uploadDate"]),
//         uploadDate: json["uploadDate"],
//         viewMode: json["viewMode"],
//       );

//   Map<String, dynamic> toJson() => {
//         "assessment": assessment,
//         "assessmentLevel": assessmentLevel,
//         "audio": audio,
//         "bilingual": bilingual,
//         "bookCode": bookCode,
//         "bookContentLink": bookContentLink,
//         "bookFeatures": bookFeatures != null ? bookFeatures?.toJson() : null,
//         "bookId": bookId,
//         "bookImageLink": bookImageLink,
//         "bookTitle": bookTitle,
//         "createTime": createTime,
//         "description": description,
//         "enabled": enabled,
//         "endDate": endDate,
//         "englishBookTitle": englishBookTitle,
//         "interestLevels": interestLevels != null
//             ? List<dynamic>.from(interestLevels!.map((x) => x.toJson()))
//             : null,
//         "keyword":
//             keyword != null ? List<dynamic>.from(keyword!.map((x) => x)) : null,
//         "keywords": keywords,
//         "language": language,
//         "level": level != null ? level?.toJson() : null,
//         "newArival": newArival,
//         "proficiencyLevel": proficiencyLevel,
//         "programTypes": programTypes != null
//             ? List<dynamic>.from(programTypes!.map((x) => x.toJson()))
//             : null,
//         "quiz": quiz,
//         "quizLinkUrl": quizLinkUrl,
//         "series": series != null
//             ? List<dynamic>.from(series!.map((x) => x.toJson()))
//             : null,
//         "startDate": startDate,
//         "teacherAssessment": teacherAssessment,
//         "teacherResource": teacherResource,
//         "textType": textType != null
//             ? List<dynamic>.from(textType!.map((x) => x.toJson()))
//             : null,
//         "textTypeResps": textTypeResps != null
//             ? List<dynamic>.from(textTypeResps!.map((x) => x.toJson()))
//             : null,
//         "topBook": topBook,
//         "topics":
//             topics != null ? List<dynamic>.from(topics!.map((x) => x)) : null,
//         "traditionalTitle": traditionalTitle,
//         //"uploadDate": uploadDate?.toIso8601String(),
//         "uploadDate": uploadDate,
//         "viewMode": viewMode,
//       };
// }

// ///api5的修改
import 'package:ichinesereader/models/book/BookLevel.dart';

class BookDetails {
  BookDetails({
    this.audio,
    this.bilingual,
    this.bookCode,
    this.bookContentLink,
    this.bookId,
    this.bookImageLink,
    this.bookLevel,
    this.level,
    this.bookTitle,
    this.color,
    this.createTime,
    this.description,
    this.enabled,
    this.englishBookTitle,
    this.newArival,
    this.proficiencyLevel,
    this.quiz,
    this.quizLinkUrl,
    this.topBook,
    this.traditionalTitle,
    this.viewMode,
  });

  String? audio;
  bool? bilingual;
  String? bookCode;
  String? bookContentLink;
  String? bookId;
  String? bookImageLink;
  Level? level;
  String? bookLevel;
  String? bookTitle;
  String? color;
  int? createTime;
  String? description;
  bool? enabled;
  String? englishBookTitle;
  bool? newArival;
  int? proficiencyLevel;
  bool? quiz;
  String? quizLinkUrl;
  bool? topBook;
  String? traditionalTitle;
  String? viewMode;

  factory BookDetails.fromJson(Map<String, dynamic> json) => BookDetails(
        audio: json["audio"],
        bilingual: json["bilingual"],
        bookCode: json["bookCode"],
        bookContentLink: json["bookContentLink"],
        bookId: json["bookId"],
        bookImageLink: json["bookImageLink"],
        bookLevel: json["bookLevel"],
        level: json["level"] != null ? Level.fromJson(json["level"]) : null,
        bookTitle: json["bookTitle"],
        color: json["color"],
        createTime: json["createTime"],
        description: json["description"],
        enabled: json["enabled"],
        englishBookTitle: json["englishBookTitle"],
        newArival: json["newArival"],
        proficiencyLevel: json["proficiencyLevel"],
        quiz: json["quiz"],
        quizLinkUrl: json["quizLinkUrl"],
        topBook: json["topBook"],
        traditionalTitle: json["traditionalTitle"],
        viewMode: json["viewMode"],
      );

  Map<String, dynamic> toJson() => {
        "audio": audio,
        "bilingual": bilingual,
        "bookCode": bookCode,
        "bookContentLink": bookContentLink,
        "bookId": bookId,
        "bookImageLink": bookImageLink,
        "bookLevel": bookLevel,
        "level": level != null ? level?.toJson() : null,
        "bookTitle": bookTitle,
        "color": color,
        "createTime": createTime,
        "description": description,
        "enabled": enabled,
        "englishBookTitle": englishBookTitle,
        "newArival": newArival,
        "proficiencyLevel": proficiencyLevel,
        "quiz": quiz,
        "quizLinkUrl": quizLinkUrl,
        "topBook": topBook,
        "traditionalTitle": traditionalTitle,
        "viewMode": viewMode,
      };
}
